package edu.gatech.cs2340.teamrocket.model.storage;

import edu.gatech.cs2340.teamrocket.control.exception.InvalidTransactionException;
import edu.gatech.cs2340.teamrocket.model.item.Item;

/**
 * Interface for any class that will distribute Items.
 *
 * @author Joe Tacheron
 */
public interface Supplier {

    /**
     * Remove a single Item from this Supplier.
     *
     * @param i the Item to remove
     */
    void removeItem(Item i);

    /**
     * Remove multiple Items from this Supplier.
     *
     * @param i the Item to remove
     * @param quantity the number of this Item to remove
     */
    void removeItem(Item i, int quantity);

    /**
     * Indicates this Supplier has the necessary resources to sell an Item
     *
     * @param i the Item to sell
     * @return true if this supplier can sell Item i, false otherwise
     */
    boolean canSellItem(Item i);

    /**
     * Indicates this Supplier has the necessary resources to sell a certain amount of an Item
     *
     * @param i the Item to sell
     * @parama quantity the amount of Item i
     * @return true if this supplier can sell the quantity of Item i, false otherwise
     */
    boolean canSellItem(Item i, int quantity);

    /**
     * Remove a single Item from this Supplier and add the value of that Item
     * to this Supplier's money amount.
     *
     * @param i the Item to sell
     * @throws InvalidTransactionException Indicates this Supplier did not have
     * enough supply to complete the transaction
     */
    void sellItem(Item i) throws InvalidTransactionException;

    /**
     * Remove a multiple Items from this Supplier and add the value of those
     * Items to this Supplier's money amount.
     *
     * @param i the Item to sell
     * @param quantity the number of this Item to sell
     * @throws InvalidTransactionException Indicates this Supplier did not have
     * enough supply to complete the transaction
     */
    void sellItem(Item i, int quantity) throws InvalidTransactionException;

    /**
     * Add money to this supplier.
     *
     * @param i the Item to sell
     * @param quantity the number of this Item to sell
     */
    void addMoney(Item i, int quantity);
}
